cmake_minimum_required(VERSION 3.0)
project(ConnectionPool LANGUAGES C CXX)

# 生成 compile_commands.json 供 clangd 使用
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# 设置 C++11 标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 数据库连接测试代码
add_executable(test_connection
    test_connection.cpp
    Connection.cpp
)
target_include_directories(test_connection PRIVATE /usr/include/mysql)
target_link_directories(test_connection PRIVATE /usr/lib64/mysql)
target_link_libraries(test_connection PRIVATE mysqlclient)

# 数据库连接池测试代码
add_executable(test_connectionpool
    test_connectionpool.cpp 
    ConnectionPool.cpp 
    Connection.cpp 
)
target_include_directories(test_connectionpool PRIVATE ./simpleini)
target_include_directories(test_connectionpool PRIVATE /usr/include/mysql)
target_link_directories(test_connectionpool PRIVATE /usr/lib64/mysql)
target_link_libraries(test_connectionpool PRIVATE mysqlclient pthread)

add_executable(stress_test
    stress_test.cpp
    ConnectionPool.cpp 
    Connection.cpp 
)
target_include_directories(stress_test PRIVATE ./simpleini)
target_include_directories(stress_test PRIVATE /usr/include/mysql)
target_link_directories(stress_test PRIVATE /usr/lib64/mysql)
target_link_libraries(stress_test PRIVATE mysqlclient pthread)